home *** CD-ROM | disk | FTP | other *** search
- /* UUEncode.ced by Troels Walsted Hansen <troels@stud.cs.uit.no>
- ** $VER: UUEncode.ced v1.00 (24.09.95)
- **
- ** An ARexx script that uuencodes a file and imports it into the
- ** CygnusEd you are currently using. Unless the file is already
- ** archived this script will optionally do it for you (using LhA).
- **
- ** Utilises LhA by Stefan Boberg and either of the following:
- ** · UUFast v1.25 by Jørn Halonen
- ** · uuIn v1.03 by Nicolas Dade
- ** · UUxT v3.1 by Asher Feldman
- */
-
- /* some user variables. edit to your hearts content */
-
- tmpdir = "T:" /* Work dir for the encoding */
- uuencoder = "uuin" /* may be: "uuin", "uufast" or "uuxt" */
- uuprogpath = "C:" /* Path to your uuencoder. This path */
- /* MUST end with either ':' or '/'. */
-
- /* do NOT edit below here unless you know what you're doing :-) */
-
- options results
-
- /* needs GoldED and bbsread.library functions */
-
- if(address() ~= 'rexx_ced') then
- do
- say "This script should only be started from inside CygnusED."
- exit 20
- end
- else gedport = address()
-
- if ~show('p', 'BBSREAD') then
- do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- /* get filename */
-
- address(bbsread)
- GETGLOBALDATA STEM GLOBALDATA
-
- address('rexx_ced')
-
- GETFILENAME '"'GLOBALDATA.UPLOADPATH'"'
- filetoencode = result
- if(rc ~= 0) then exit
-
- lastchar = right(filetoencode,1)
- if(lastchar = "/" | lastchar = ":" | filetoencode = "RESULT") then
- do
- OKAY1 'No file selected!'
- signal exit
- end
-
- posi = lastpos("/",FileToEncode)
- if(posi = 0) then posi = lastpos(":",FileToEncode)
- WithoutPath = substr(FileToEncode,posi+1)
-
- /* if file isn't LhA'ed -- do it ourselves */
-
- extension = upper(substr(FileToEncode, lastpos(".",FileToEncode)+1))
-
- if~(extension = "LHA" | extension = "LZH") then
- do
- OKAY2 'Do you want to LhA the file?'
- if(result) then
- do
- address command "LhA >nil: -y -q a "||'"'tmpdir||WithoutPath'"'||" "||'"'FileToEncode'"'
-
- if(rc ~= 0) then OKAY1 'LhA''ing did not succeed.'
- else FileToEncode = tmpdir||WithoutPath||".lha"
- end
- end
-
- select
- when(upper(uuencoder) = 'UUFAST') then cmd = uuprogpath || 'UUFast >nil: ' || '"' || filetoencode || '"' || " TO " || tmpdir || "Message.uu E"
- when(upper(uuencoder) = 'UUIN') then cmd = uuprogpath || 'uuIn >nil: INFILE=' || '"' || filetoencode || '"' || " OUTFILE=" || tmpdir || "Message.uu"
- when(upper(uuencoder) = 'UUXT') then cmd = uuprogpath || 'UUxT >nil: a ' || tmpdir || 'Message.uu ' || '"'filetoencode'"'
- otherwise
- do
- OKAY1 'UUEncoder not configured correctly.'
- signal exit
- end
- end
- address command cmd
-
- address('rexx_ced')
-
- if ~exists(tmpdir"Message.uu") then
- do
- OKAY1 'Something went wrong during uuencoding.'
- signal exit
- end
-
- INCLUDE FILE tmpdir || 'Message.uu'
-
- /* cleanup and exit */
-
- exit:
- if(exists(tmpdir || WithoutPath || ".lha")) then address command 'delete >nil: ' || '"' || tmpdir || WithoutPath || '.lha' || '"'
- if(exists(tmpdir || "Message.uu")) then address command 'delete >nil: ' || tmpdir || 'Message.uu'
- exit
-